package com.ddd.core.constants.enums;

import com.ddd.core.api.IResultCode;
import lombok.AllArgsConstructor;
import lombok.Getter;
import org.springframework.http.HttpStatus;

/**
 * @author zhongwenbin
 * @date 2023/6/24 22:38
 */

@Getter
@AllArgsConstructor
public enum ApiCodeEnum implements IResultCode {

    SUCCESS("200", "OK", "OK"),
    UNAUTHORIZED("401", "未登录", "用户未登录"),
    PARAMETER_ILLEGAL("400", "错误的请求", "错误的请求"),
    FORBIDDEN("403", "未拥有该权限", "未拥有该权限"),
    METHOD_NOT_ALLOWED("405", "请求类型错误:", HttpStatus.METHOD_NOT_ALLOWED.getReasonPhrase()),
    FAILED("500", "服务异常", "服务异常"),
    // 业务逻辑异常
    UNIQUE_ERROR("50001", "数据已存在！", "唯一索引异常");;
    /**
     * 状态码
     */
    private final String code;
    /**
     * 消息说明
     */
    private final String message;
    /**
     * 内部消息说明
     */
    private final String innerMsg;

}
